from flask.blueprints import Blueprint
from toutiaoapi.flaskrestful import BaseApi

home_blueprint=Blueprint('home',__name__,url_prefix='/app/v1_0')

#视图函数要导回来，否则访问不到
from . import views

from flask_restful import Api
home_api = BaseApi(home_blueprint)
#首页文章列表
home_api.add_resource(views.IndexResource,'/articles')

#获取所有频道
home_api.add_resource(views.AllChannelResource,'/channels')

# 用户关注频道
home_api.add_resource(views.UserChannelResource,'/user/channels')

from . import detail,comment

#文章详情页面
home_api.add_resource(detail.DetailResource,'/articles/<article_id>')

#关注用户
home_api.add_resource(detail.FollowResource,'/user/followings')

#取消关注用户
home_api.add_resource(detail.FollowingDeleteResource,'/user/followings/<target>')

#点赞文章
home_api.add_resource(detail.AttitudeLikingResource,'/article/likings')

#取消点赞
home_api.add_resource(detail.AttitudeLikeDeleteResource,'/article/likings/<target>')

#不喜欢文章
home_api.add_resource(detail.DislikeResource,'/article/dislikes')

#取消不喜欢文章
home_api.add_resource(detail.DislikeDeleteResource,'/article/dislikes/<target>')

# 收藏文章
home_api.add_resource(detail.UserCollectionResource,'/article/collections')
#取消收藏
home_api.add_resource(detail.UserCollectDeleteResource,'/article/collections/<target>')

# 发表评论,1为个人能理解版，２为加缓存后老师版
home_api.add_resource(comment.CommentResource,'/comments')
# home_api.add_resource(comment.CommentResource2,'/comments')

# 给某条评论点赞
home_api.add_resource(comment.CommentLikingResource,'/comment/likings')

#用户浏览记录
home_api.add_resource(detail.ReadingHistoryResource,'/user/histories')


#用户粉丝列表，谁关注了我
home_api.add_resource(detail.FansResource,'/user/followers')